Methods and systems for compressing and transmitting media signals are known in the art. Compressed digital video is largely becoming the preferred medium to transmit video to viewers everywhere. Part of the Moving Pictures Experts Group (MPEG) specifications are standardized methods for compressing and transmitting video. Various audio compression techniques, including MPEG compliant techniques, are also known in the art. In general, MPEG is used today for transmitting video over terrestrial, wireless, satellite and cable communication channels and also for storing digital video.
An audio stream is organized as an ordered sequence of frames. A video stream is usually organized as an ordered sequence of pictures; each picture includes a plurality of pixels. A video picture includes a plurality of slices, each slice including a plurality of macro blocks. The audio and video streams are provided to an audio encoder and video encoder respectively to generate compressed audio and video elementary streams, also referred to as elementary streams.
Elementary streams are packetized to produce PES packets. PES packets made up of elementary streams that form a program share a common time base. The PES packets may also include additional information. PES packets of distinct elementary streams can be arranged as a program stream or a transport stream. A transport stream combines one or more programs with one or more independent time bases into a single stream. A transport stream that includes a single program is referred to as a single program transport stream (SPTS) while a transport stream that combines multiple programs is referred to as a multiple program transport stream (MPTS).
Transport Streams include transport packets of 188 bytes. Transport Stream packets start with a transport packet header. The header includes a packet ID (PID). Transport Stream packets of one PID value carry data of a single elementary stream. Transport Streams include Program Specific Information (PSI) tables. The PSI tables specify which PIDs and accordingly which elementary streams are associated to form each program.
The PSI tables are embedded within transport stream packets that have unique PID values that distinguish them from the elementary stream conveying transport stream packets.
Each program includes timing information that allows a reconstruction of the programs time base. The timing information is known as program clock reference (program clock reference). Not each transport packet includes a program clock reference. According to various standards program clock references should be transmitted at least once per 100 milliseconds or at least once per 40 milliseconds. The program clock reference is included in an adaptation field, as illustrated by the following tables.
TABLE 1Partial transport stream packet formatNumberNameof bitssync byte80x47Transport Error1Set by demodulator if can't correctIndicator (TEI)errors in the streamPayload Unit11 means start of PES data or PSI otherwiseStart Indicatorzero only.Transport Priority1One means higher priority than otherpackets with the same PID.PID13Packet IDScrambling2‘00’ = Not scrambled. The following percontrolDVB spec: ‘01’ = Reserved for future use, ‘10’ = Scrambled with evenkey,‘11’ = Scrambled with odd keyAdaptation field11 means presence of the adaptation fieldexistPayload data11 means presence of dataexistContinuity4counterNote: the total number of bits above is32 and is called the transport stream4-byte prefix.Adaptation field0 orDepends on flagsmorePayload Data0 orDepends on flagsmore
TABLE 2adaptation field formatNumberNameof bitsDescriptionAdaptation Field8Number of bytes in the adaptation fieldLengthimmediately following this byteDiscontinuity indicator1Set to 1 if a discontinuity occurredin the continuity counter of theTS packetRandom Access1Set to 1 if the PES packet in this TSindicatorpacket starts a video/audio sequenceElementary stream11 = higher prioritypriority indicatorprogram clock11 means adaptation field does containreference flaga program clock reference fieldProgram clock1reference flagSplicing point flag11 means presence of splice countdownfield in adaptation fieldTransport private data11 means presence of private data bytesflagin adaptation fieldAdaptation field11 means presence of adaptationextension flagfield extensionBelow fields arevariableDepends on flagsoptionalPCR33+9Program clock referenceOPCR33+9Original Program clock reference.Helps when one TS is copied intoanotherSplice countdown8Indicates how many TS packets fromthis one a splicing point occurs(may be negative)stuffing bytesvariable
The multiple program transport stream is generated in view of strict timing constraints. Transport stream packets of each program that forms the multiple program transport stream are timed such as not to cause overflows or underflows in target decoders that are expected to decode the elementary streams of that program.
Underflow and overflow are avoided by a resource consuming stage of modeling the buffers of each target decoder and determining the timing of transport stream packets in a manner that avoids overflows and underflows. The characteristics of the target decoder are defined in the MPEG specifications. They are collectively known as T-STD (Transport-System Target Decoder). One important buffer included in the T-STD is known as EB.
Timing information embedded within the transport stream packets also reflects the overall bit rate of the whole multiple program transport stream. For example, the bit rate of the whole multiple program transport stream can be determined by dividing (i) the number of transport stream packets between the transport stream packets that include these two consecutive program time references multiplied by the number of bits per packet by (ii) the timing difference between two consecutive program time references (of the same program).
In various scenarios there is a need to extract a single program transport stream out of a multiple program transport streams. Without specific pre-processing or expensive processing such as de-jittering & buffer modeling, as well as buffering, simply extracting the PIDs of a program from a multiple program transport stream would yield an illegal and non-complying single program transport stream in most cases. Generally, one cannot assume that down stream devices would be able to cope with non-compliant streams.
Many devices, however, do attempt to perform the extraction in a non-expensive manner, hoping for the best and yet usually producing non-compliant streams. One must assume that these devices would continue to be utilized.
Accordingly, there is a need to provide methods, devices and computer program products that will enable an easy extraction of a single program transport stream out of a multiple program transport stream.